#include "thread.h"
#include"QTime"
Thread::Thread()
{

    // 设置线程在对象销毁时自动停止
    connect(this, &Thread::finished, this, &Thread::deleteLater);
}

void Thread::run()
{
    while(1)
    {
        QString time=QTime::currentTime().toString("hh:mm:ss");//获取当前时间
        emit sendTime(time);
        sleep(1);//线程休眠1秒
    }

}

